package r4.powtorka3;

import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class AgaUrodziny {

	public static void main(String[] args) {

		Date dzis = new Date();
		DateFormat formaterDaty = DateFormat.getDateInstance();
		DateFormat formaterCzasu = DateFormat.getTimeInstance();
		System.out.println(formaterDaty.format(dzis));
		System.out.println(formaterCzasu.format(dzis));
		
		String[] dniTygodnia = new DateFormatSymbols().getWeekdays();
		String[] miesiace = new DateFormatSymbols().getMonths();
		
		GregorianCalendar kalendarz = new GregorianCalendar();
		System.out.println(formaterDaty.format(kalendarz.getTime()));
		System.out.println(formaterCzasu.format(kalendarz.getTime()));
		
		System.out.println(miesiace[kalendarz.get(Calendar.MONTH)] + ", " + dniTygodnia[kalendarz.get(Calendar.DAY_OF_WEEK)]);
		System.out.println(kalendarz.get(Calendar.DAY_OF_WEEK_IN_MONTH));
		kalendarz.add(Calendar.DAY_OF_WEEK_IN_MONTH, -1);
		System.out.println(kalendarz.getTime());
		
		kalendarz.set(2009, Calendar.NOVEMBER, 9);
		System.out.println(dniTygodnia[kalendarz.get(Calendar.DAY_OF_WEEK)]);
	}

}
